﻿using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;
using YouHP.Model.Group;

namespace YouHP.Pages.User.Group
{
    public class GroupBasePage : UserBasePage
    {
        protected Model.Group.GroupInfo GroupData { get; set; }
        protected Model.Group.GroupUserInfo GroupUserData { get; set; }

        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;

            HandleCommon();
            if (IsPost) HandlePost();
            else HandleGet();
        }

        protected void HandleCommon()
        {
            int gid = RequestTools.GetInt("gid", 0);
            if (gid == 0) 
            {
                this.AddErrLine("找不到指定的圈子！");
                return;
            }
            GroupData = GroupBLL.Instance.GetGroupInfo(gid);
            if (GroupData.Id <= 0)
            {
                this.AddErrLine("找不到指定的圈子！");
                return;
            }
            //用户与圈子关系
            GroupUserData = GroupUserBLL.Instance.GetGroupUserInfo(GroupData.Id, UserData.Id);
            this.AddLocation(GroupData.GroupName, "/Group/Group.aspx?gid="+GroupData.Id);
        }

        protected void HandlePost()
        {
           
        }

        protected void HandleGet()
        {

        }
    }
}